<?php 


?>

<table id="whislist_table" class="table table-striped table-bordered table-hover">
	<thead>
		<tr>	
			<th><?php  echo translate_word_shop('name',$dictionary_app); ?></th>
			<th><?php  echo translate_word_shop('email',$dictionary_app); ?></th>
			<th><?php  echo translate_word_shop('telephone',$dictionary_app); ?></th>
			<th><?php  echo translate_word_shop('city',$dictionary_app); ?></th>
			<th><?php  echo translate_word_shop('person_type',$dictionary_app); ?></th>
			<th><?php  echo translate_word_shop('nr_product_whislist',$dictionary_app); ?></th>
			<th><?php  echo translate_word_shop('Actions',$dictionary_app); ?></th>
		</tr>
	</thead>
	<tbody>
	<?php	

		$results = $shopObj->fetch_result("SELECT DISTINCT(client_id),clients.name,clients.email,clients.type,clients.phone,clients.city_id FROM clients,clients_wishlists WHERE clients_wishlists.client_id=clients.id");
		foreach($results as $key=>$value){
			$nr = $shopObj->num_rows("SELECT id FROM clients_wishlists WHERE client_id = '{$value['client_id']}'");
					
			$city = $shopObj->fetch_one("SELECT name FROM cities WHERE id='{$value['city_id']}'");
			if($results['person_type']==0){
				$type = translate_word_shop('individual_person');
			}else{
				$type = translate_word_shop('legal_person');
			}
			echo "<tr>	
					<td>{$value['name']}</td>
					<td>{$value['email']}</td>
					<td>{$value['phone']}</td>
					<td>{$city['name']}</td>
					<td>{$type}</td>
					<td>{$nr}</td>
					<td>
						<a href ='".SERVER_PATH."wishlist/client_wishlist/{$value['client_id']}.html' class='btn btn-mini btn-success'><i class='icon-pencil bigger-125'></i>".translate_word_Shop('view_wishlist')."</a>
					</td>
				  </tr>";
		}
	?>	
	</tbody>
</table>
